package ooday0004;

public class Tests {
    public static void main(String[] args) {
        Animal[]animals=new Animal[3];
        animals[0]=new Dog("黄黄",1,"黄");
        animals[1]=new Fish("白白",2,"红");
        animals[2]=new chick("白白",4,"黑");
        for (int i=1;i<animals.length;i++){
            System.out.println(animals[i].name+animals[i].age+animals[i].color);
            animals[1].eat();
            animals[2].drink();
            if (animals[i]instanceof Dog){
                Dog dog=(Dog) animals[i];
                dog.lookhome();
                dog.swim();
            }
            if (animals[i]instanceof chick){
                chick chick=(chick) animals[i];
                chick.layeggs();
                chick.eat();
            }
            if (animals[i]instanceof Fish){
                Fish fish=(Fish) animals[i];
                fish.eat();
                fish.swim();
            }
            if (animals[i]instanceof SWIM){
                SWIM S=(SWIM) animals[i];


            }
        }
    }

}

